package com.hontech.bread.ui.parts

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bread.R
import com.hontech.bread.device.middlePushBack
import com.hontech.bread.device.middlePushFront
import com.hontech.bread.ui.dialog.runProg
import com.hontech.bread.utils.onClick
import com.hontech.bread.utils.stringById

class MiddlePushMotorParts(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_middle_push_test, this)
        val front = view.findViewById<Button>(R.id.id_middle_push_front)
        val back = view.findViewById<Button>(R.id.id_middle_push_back)

        front.onClick {
            runProg(stringById(R.string.t1733460848_422), stringById(R.string.t1733460848_423)) {
                middlePushFront()
            }
        }
        back.onClick {
            runProg(stringById(R.string.t1733460848_424), stringById(R.string.t1733460848_425)) {
                middlePushBack()
            }
        }
    }
}
